﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head><link rel="stylesheet" href="${ctx}/common/common.css">
    <title>Title</title>

    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
     <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>
    
    <script src="${ctx}/common/plugins/publicJs/publicJs.js"></script>
    <style>
        .layui-body{overflow-y: scroll;}
    </style>
</head>
<body>
<!--主体内容层-->
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12"  style="padding-top: 10px;padding-bottom: 10px">
        <div style="float: right;" class="layui-btn-group paramBtn">
            <button data-type="backLabel" type="button" class="layui-btn layui-btn-sm layui-btn-primary">
                返回
            </button>
        </div>
    </div>
        <div class="layui-col-md12 layui-col-space15">


            <table class="layui-table" id="labelReload" lay-data="{ url:'${ctx}/label/findWorksheetPage?tbId=${tbId }', page:true,groups:5}" lay-filter="demo">
                <thead>
                <tr>
                   <!--  <th lay-data="{type:'checkbox', fixed: 'left'}"></th> -->
                    <th lay-data="{field:'code',sort:true}">加工单号</th>
                    <th lay-data="{field:'estimated_output',sort:true}">预计产量</th>
                    <th lay-data="{field:'actual_output',sort:true}">实际产量</th>
                    <th lay-data="{field:'p_date',sort:true,width:'17%',templet:'#createTime'}">生产日期</th>
                    <th lay-data="{field:'process_stat',sort:true,width:100,templet:'#process_stat'}">加工状态</th> 
                    <th lay-data="{field:'startup_stat',sort:false,width:'10%'}">启用状态</th>
                    <th lay-data="{field:'stat',toolbar:'#barDemo',width:'30%'}">操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
</div>
<script type="text/html" id="process_stat">
  {{#  if(d.process_stat == 0){ }}
   待加工
  {{#  } }}
{{#  if(d.process_stat == 1){ }}
 加工中
  {{#  } }}
{{#  if(d.process_stat == 2){ }}
 已完成
  {{#  } }}
</script>
<script type="text/html" id="barDemo">

  {{#  if(d.count > 0){ }}
    <a class="layui-btn layui-btn-sm" lay-event="exportByWorksheet">导出标签</a>
  {{#  } }}
</script>
<script id="createTime" type="text/html">
    {{# return layui.getDate(d.create_time, 'yyyy-MM-dd hh:mm:ss');}}
</script>
</body>
<script>

    layui.use('table', function () {
        var loading=layer.msg("数据加载中...");
        var table = layui.table;
        table.render({
            done:function(){
                layer.close(loading);
            }
        })
        //监听filter为demo的table中的工具条
        table.on('tool(demo)', function (obj) {
            var data = obj.data;
            if(obj.event==='exportByWorksheet'){
           	 window.location.href = '${ctx}/label/exportLabel?workSheetId=' + obj.data.id
           }
        });

        var $ = layui.$, active = {
            backLabel: function () {
            	window.history.back();
            }


        };

        $('.demoTable .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        //给按钮绑定active中的方法
        $(".paramBtn .layui-btn").on("click", function () {
            var type = $(this).data('type');
            //查看是active这个json中是否有type这个方法，如果有调用，如果没有不知心；
            active[type] ? active[type].call() : '';
        })

    });
    document.getElementById("rollback").addEventListener("click",function(){
        window.history.back();
    })
</script>
</html>



